package com.hermes.test;

import java.util.Date;

import com.hermes.biz.common.model.item.ItemDO;
import com.hermes.biz.manager.item.impl.ItemOperateManagerImpl;
import com.hermes.common.action.AsynBaseAction;
import com.hermes.common.util.ParameterParserUtil;

public class InItem extends AsynBaseAction{
	public ItemOperateManagerImpl itemOperateManager;
	public String result = "false";
	@Override
	public String execute() throws Exception {
		String mmk = ParameterParserUtil.getParameter("mmk");
		if(!mmk.equals("130012")){
			return SUCCESS;
		}
		String itemid = ParameterParserUtil.getParameter("itemid");
		String title = ParameterParserUtil.getParameter("title");
		String tagid = ParameterParserUtil.getParameter("tagid");
		String pictureurl = ParameterParserUtil.getParameter("pictureurl");
		String description = ParameterParserUtil.getParameter("description");
		String buyurl = ParameterParserUtil.getParameter("buyurl");
		String createuserid =  ParameterParserUtil.getParameter("userid");
		String cates = ParameterParserUtil.getParameter("cates");
		String tags = ParameterParserUtil.getParameter("tags");
		String descriptionsimple = ParameterParserUtil.getParameter("descriptionsimple");
		
		ItemDO itemDo = new ItemDO();
		itemDo.setDescription_simple(descriptionsimple);
		itemDo.setItemId(Long.valueOf(itemid));
		itemDo.setItemTitle(title);
		itemDo.setTagId(Integer.valueOf(tagid));
		itemDo.setItemPicUrl(pictureurl);
		itemDo.setDescription(description);
		
		itemDo.setBuy_url(buyurl);
		
		itemDo.setClickNum(0);
		itemDo.setBelovedNum(0);
		itemDo.setGmtCreate(new Date());
		itemDo.setGmtModified(new Date());
		itemDo.setCreateUserId(Long.valueOf(createuserid));
		itemDo.setIsWeb(1);
		itemDo.setIsPicture("1");
		cates = cates.substring(0, cates.length()-1);
		tags = tags.substring(0, tags.length()-1);
		itemDo.setCategory(cates);
		itemDo.setTags(tags);
		
		itemOperateManager.saveSingleItem(itemDo);
		result = "true";
		return SUCCESS;
	}
	//
	public ItemOperateManagerImpl getItemOperateManager() {
		return itemOperateManager;
	}
	public void setItemOperateManager(ItemOperateManagerImpl itemOperateManager) {
		this.itemOperateManager = itemOperateManager;
	}
}
